package com.ch03;

public class ConstructorChild extends Constructors{
	/*
	 * This method overrides the method from the parent
	 * @see com.ch03.Constructors#subtract(int, int)
	 */
	public int subtract(int no1, int no2) {
		System.out.println("In subtract method of child " + no1 + "," + no2);
		return no1-no2;
	}
	
	/*
	 * This method has to be public. It cannot be private, protected or package access
	 * You cannot reduce visibility of a method if you override it.
	 * @see com.ch03.Constructors#divide(double, double)
	 */
	private double divide(double no1, double no2) {
		return no1 / no2;
	}

	public static void main(String args[]) {
		ConstructorChild obj = new ConstructorChild();
		//This calls the child method
		System.out.println(obj.subtract(20, 10));
		//This calls the parent method
		System.out.println(obj.subtract(20.5, 10));
	}

}

